package practice.w912;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class ListDemo2 {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        Random random = new Random();
        for (int i = 0; i <10 ; i++) {
            list.add(random.nextInt(100));
        }
        System.out.println("list:"+list);

        List<Integer> subList = list.subList(2,7);
        System.out.println("subList:"+subList);

        for (int i = 0; i <subList.size(); i++){
            subList.set(i,subList.get(i)*10);
        }
        System.out.println("list扩大10倍:"+list);


//        List<Integer> list = new ArrayList<>();
//        Random random = new Random();
//        for (int i = 0; i <10 ; i++) {
//            list.add(random.nextInt(100));
//        }
//        System.out.println("list:"+list);
//
//        List<Integer> subList = list.subList(2,7);
//        System.out.println("subList:"+subList);
//
//        for (int i = 0; i <subList.size(); i++){
//            subList.set(i,subList.get(i)*10);
//        }
//        System.out.println("list扩大10倍:"+list);

    }
}
